package com.miracle.system.service;

import java.util.List;

import com.miracle.system.domain.SysResource;
import com.miracle.system.domain.SysUser;
import com.miracle.system.domain.TreeEntity;
import com.miracle.system.domain.vo.ResourceVo;

/**
 * 菜单 业务层
 *
 * @author miracle
 */
public interface SysResourceService
{
    /**
     * 根据用户ID查询权限
     *
     * @param userId 用户ID
     * @return 权限列表
     */
    public List<String> selectPermissionListByUserId(Integer userId);

    public List<String> selectPermissionListByUser(SysUser user);

    public List<SysResource> selectResourceByUserId(Integer userId);

    public List<SysResource> selectResourceByRoleId(Integer roleId);

    /**
     * 构建前端路由所需要的菜单
     *
     * @param resources 菜单列表
     * @return 路由列表
     */
    public List<ResourceVo> buildResources(List<SysResource> resources);

    /**
     * 构建前端所需要树结构
     *
     * @param resources 菜单列表
     * @return 树结构列表
     */
    public List<TreeEntity> buildResourceTree(List<SysResource> resources);

    public List<SysResource> selectResourceList(SysResource resource);

    public Integer insertResource(SysResource resource);

    public Integer updateResource(SysResource resource);

    public List<SysResource> selectResourceByParentResourceId(Integer parentResourceId);

    public SysResource selectResourceByResourceId(Integer resourceId);

    public Integer deleteResourceByResourceIds(Integer[] resourceIds);

    public SysResource remoteCheckResource(SysResource resource);
}
